using System;
using System.IO;

namespace DynamicConfigurationManager.ConfigMapAttributes
{
    /// <summary>
    /// ExecutablePath compares the configMapAttribute value to the fully qualified path of the AppDomain's current base directory.
    /// </summary>
    internal class ExecutablePath : IConfigMapAttribute
    {
        public bool Execute( string configMapAttribute )
        {
            var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
            LogHelper.Append( "ExecutablePath: matching to {0}", baseDirectory );
            var fullPath = Path.GetFullPath( configMapAttribute.TrimEnd( '\\' ) );
            return fullPath.Equals( baseDirectory, StringComparison.InvariantCultureIgnoreCase );
        }
    }
}